package com.zh.common.view

import android.content.Context
import android.util.AttributeSet
import android.widget.FrameLayout
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.blankj.utilcode.util.SizeUtils
import com.zh.common.R
/**
 * 自定义Loading页面
 */
class XLoadingView @JvmOverloads constructor(
    context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr) {

    private val view = inflate(context, R.layout.viewstatus_loading, this)
    private val tvContent = view.findViewById<TextView>(R.id.tv_content)

    fun setTextDesc(desc: String) {
        tvContent.text = desc
    }

    fun setTextSize(size: Float) {
        tvContent.textSize = SizeUtils.px2sp(size).toFloat()
    }

    fun setTextColor(color: Int) {
        tvContent.setTextColor(ContextCompat.getColor(context, color))
    }
}